package com.jiayi.data.entity;

import com.doudou.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 关于我们 各项配置的实体类集合
 */
public class CmsAboutUsClass implements Serializable {

    /**
     * 首页图片
     * 在JiayiAboutUs.value中是一个list字符串
     * 该对象是list[i]
     *
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    @Builder
    public static class HomeImage implements Serializable{

        private Integer id;

        /** 地址 */
        private String url;
    }

    /**
     * 发展历程
     * 在JiayiAboutUs.value中是一个list字符串
     * 该对象是list[i]
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    @Builder
    public static class DevHistory implements Serializable{

        private Integer id;

        /** 时间 */
        @JsonFormat(pattern = DateUtil.yyyyMMdd)
        private Date date;

        /** 标题 */
        private String title;

        /** 详情 */
        private String info;
    }

    /**
     * 企业荣誉
     * 在JiayiAboutUs.value中是一个list字符串
     * 该对象是list[i]
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    @Builder
    public static class CompanyHonor implements Serializable{

        private Integer id;

        /** 类型 字典 */
        private String type;

        /** 名称 */
        private String name;

        /** 时间 */
        @JsonFormat(pattern = DateUtil.yyyyMMdd)
        private Date date;

        /** 图片地址 */
        private String photoUrl;

        /** 详情 */
        private String info;
    }

    /**
     * 联系我们
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    @Builder
    public static class CallUs implements Serializable{

        /** 地址集合 @see CallUsAddress */
        private List<CallUsAddress> callUsAddressList;

        /** 联系人 @see CallUsManager */
        private List<CallUsManager> callUsManagerList;

        /** 邮箱 @see CallUsEmail */
        private List<CallUsEmail> callUsEmailList;

        public void parseAddressList(){
            for (int i = 0; i < this.callUsAddressList.size(); i++) {
                this.callUsAddressList.get(i).setId(i+1);
            }
        }

        public void parseManagerList(){
            for (int i = 0; i < this.callUsManagerList.size(); i++) {
                this.callUsManagerList.get(i).setId(i+1);
            }
        }

        public void parseEmailList(){
            for (int i = 0; i < this.callUsEmailList.size(); i++) {
                this.callUsEmailList.get(i).setId(i+1);
            }
        }
    }

    /**
     * 联系我们-地址
     * @see CallUs#callUsAddressList
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    @Builder
    public static class CallUsAddress implements Serializable{

        private Integer id;

        /** 名称 */
        private String name;

        /** 详情 */
        private String info;
    }

    /**
     * 联系我们-联系经理
     * @see CallUs#callUsManagerList
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    @Builder
    public static class CallUsManager implements Serializable{

        private Integer id;

        /** 名称 */
        private String name;

        /** 电话号码 */
        private String telephone;

        /** 是否微信同号 */
        private Boolean isWechat;

        /** 二维码 */
        private String qrcodeUrl;
    }

    /**
     * 联系我们-联系邮箱
     * @see CallUs#callUsEmailList
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    @Builder
    public static class CallUsEmail implements Serializable{

        private Integer id;

        /** 名称 */
        private String name;

        /** 邮箱 */
        private String email;
    }
}









